<?php
namespace Biz\model;

use Doraemon\pockets\datebase\BaseDbModel;

class ShopAnnounce extends BaseDbModel
{

	const _CONFIG_FILE_ = 'db_shop';

	const _CONFIG_SELECT_ = 'db_shop';

	const _DATABASE_ = 'shop';

	const _TABLE_NAME = 'shop_announcement';

	const STATUS_DISABLED = 0;//失效状态

	const STATUS_NORMAL = 1;//正常状态


	public static function insertData($uid, $announce)
	{
		self::insert([
			'shop_id' => $uid,
			'announcement' => $announce,
			'add_time' => date('Y-m-d H:i:s'),
			'status' => self::STATUS_NORMAL
		]);

		return self::id();
	}

	public static function getAnnounce($shopId)
	{
		return self::get('announcement', [
			'shop_id' => $shopId,
			'status' => self::STATUS_NORMAL
		]);
	}
}